package com.ztp.pc.test2;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSplitPane;
import java.awt.BorderLayout;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.JPanel;

import com.ztp.pc.gui.gtabpane.GTabPane;

public class GtabPaneDropTest {

	private JFrame frame;
	public JSplitPane splitPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					GtabPaneDropTest window = new GtabPaneDropTest();
					window.frame.setVisible(true);
					window.splitPane.setDividerLocation(0.5);
					
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public GtabPaneDropTest() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 638, 360);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		splitPane = new JSplitPane();
		splitPane.addComponentListener(new ComponentAdapter() {
			@Override
			public void componentResized(ComponentEvent e) {
				//out.println(e.paramString() + " " + splitPane.getSize().width + splitPane.getSize().height);
				super.componentResized(e);
			}
		});
		frame.getContentPane().add(splitPane, BorderLayout.CENTER);
		
		JPanel panel = new JPanel();
			GTabPane leftpane = new GTabPane();
			leftpane.setName("leftpane");
			leftpane.addCard(new JLabel("1"), "1");
			leftpane.addCard(new JLabel("2"), "2");
			leftpane.addCard(new JLabel("3"), "3");
			leftpane.addCard(new JLabel("4"), "4");
			leftpane.addCard(new JLabel("5"), "5");
			
		panel.setLayout(new BorderLayout(0, 0));
		panel.add(leftpane);
		splitPane.setLeftComponent(panel);
		
		JPanel panel_1 = new JPanel();
			GTabPane rightpane = new GTabPane();
			rightpane.setName("rightpane");
			
			rightpane.addCard(new JLabel("A"), "A");
			rightpane.addCard(new JLabel("B"), "B");
			rightpane.addCard(new JLabel("C"), "C");
			rightpane.addCard(new JLabel("D"), "D");
			rightpane.addCard(new JLabel("E"), "E");
			rightpane.addCard(new JLabel("F"), "F");
			panel_1.setLayout(new BorderLayout(0, 0));
			panel_1.add(rightpane);
		
		splitPane.setRightComponent(panel_1);
	}

}
